package com.example.domain.entity;

import javax.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 订单明细实体类
 * 
 * <p><strong>注意：订单功能暂未开发，此实体类暂时未使用</strong></p>
 * 
 * <p>此实体类映射数据库表 order_items，保留用于数据库表结构管理。</p>
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "order_items")
public class OrderItem extends SoftDeleteEntity {

    @Id
    @Column(name = "id", length = 26)
    private String id;

    @Column(name = "order_id", length = 26, nullable = false)
    private String orderId;

    @Column(name = "product_id", length = 26, nullable = false)
    private String productId;

    // 数量信息
    @Column(name = "quantity_value", precision = 18, scale = 6, nullable = false)
    private BigDecimal quantityValue;

    @Column(name = "quantity_unit", length = 20, nullable = false)
    private String quantityUnit;

    @Column(name = "normalized_quantity", precision = 18, scale = 6, nullable = false)
    private BigDecimal normalizedQuantity;

    @Column(name = "base_unit", length = 20, nullable = false)
    private String baseUnit;

    // 价格信息
    @Column(name = "unit_price", precision = 18, scale = 4, nullable = false)
    private BigDecimal unitPrice;

    @Column(name = "line_before_discount", precision = 18, scale = 4, nullable = false)
    private BigDecimal lineBeforeDiscount;

    @Column(name = "line_after_discount", precision = 18, scale = 4, nullable = false)
    private BigDecimal lineAfterDiscount;

    // 乐观锁版本号
    @Version
    @Column(name = "version")
    private Long version = 1L;
}

